find_package(PkgConfig)
pkg_check_modules(APR apr-1)
if (NOT PCL_FOUND)
    find_package(PCL  REQUIRED)
endif ()
# if (NOT Boost_FOUND)
find_package(Boost  REQUIRED COMPONENTS system thread)
# endif()
if (NOT OPENMP_FOUND)
    find_package(OpenMP)
endif ()
if (OPENMP_FOUND)
    message(STATUS "Found openmp")
    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()

if (NOT OPENCV_FOUND)
    find_package(OpenCV REQUIRED)
endif()

add_library(ldslidar SHARED lds_lidar.cpp)
target_include_directories(ldslidar PUBLIC ${PROJECT_SOURCE_DIR}/ldslidar ${APR_INCLUDE_DIRS}  ${Boost_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS}
	${PCL_INCLUDE_DIRS} )
target_link_libraries(ldslidar
        ${PCL_LIBRARIES}
        # -Wl,--whole-archive
        livox_sdk_static
        ${Boost_LIBRARIES}
         ${APR_LIBRARIES}
        #-Wl,--no-whole-archive
        )
